🏡 index : github.com/captn3m0/codechef.git

---
category_name: school
problem_code: KFIB
problem_name: 'K Fibonnaci'
languages_supported:
    - C
    - 'CPP 4.3.2'
    - 'CPP 6.3'
    - CPP14
    - JAVA
    - PYPY
    - PYTH
    - 'PYTH 3.5'
max_timelimit: '1'
source_sizelimit: '50000'
problem_author: adhyyan1252
problem_tester: null
date_added: 10-11-2017
tags:
    - adhyyan1252
time:
    view_start_date: 1510331400
    submit_start_date: 1510331400
    visible_start_date: 1510331400
    end_date: 1735669800
    current: 1514815984
layout: problem
---
All submissions for this problem are available.Problem description.

Chef recently had been studying about Fibonacci numbers and wrote a code to print out the kth term of the Fibonacci series(1, 1, 2, 3, 5, 8, 13….). He was wondering whether he could write a program to generate the **kth** term for similar series. More specifically : **T(n, k) is 1 if n k** . Given n and k output **T(n, k)%(1000000007)** as the answer could be very large ### Input

Two integers, **N** and **K**### Output

Output description.

One integer, the nth term of the series mod 1000000007 ### Constraints

19. **1** ≤ **N, K** ≤ **2\*105**
### Example

<pre><b>Input:</b>
7 5

<b>Output:</b>
9
<p> </p>
<h3>Explanation</h3>
<p><b>Example case 1. The series is as follows {1, 1, 1, 1, 1, 5, 9}</b></p>
</pre>