### Prompt

Develop a solution in cpp to the problem described below:

Andrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players.

Given a group of n non-empty strings. During the game two players build the word together, initially the word is empty. The players move in turns. On his step player must add a single letter in the end of the word, the resulting word must be prefix of at least one string from the group. A player loses if he cannot move.

Andrew and Alex decided to play this game k times. The player who is the loser of the i-th game makes the first move in the (i + 1)-th game. Guys decided that the winner of all games is the player who wins the last (k-th) game. Andrew and Alex already started the game. Fedor wants to know who wins the game if both players will play optimally. Help him.

Input

The first line contains two integers, n and k (1 ≤ n ≤ 105; 1 ≤ k ≤ 109).

Each of the next n lines contains a single non-empty string from the given group. The total length of all strings from the group doesn't exceed 105. Each string of the group consists only of lowercase English letters.

Output

If the player who moves first wins, print "First", otherwise print "Second" (without the quotes).

Examples

Input

2 3
a
b

Output

First

Input

3 1
a
b
c

Output

First

Input

1 2
ab

Output

Second

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int MX = 2000000;
const long long inf = 1e18;
const long long mod = 1e9 + 7;
struct node {
  int in[26];
  node() { memset(in, -1, sizeof(in)); }
};
node T[MX];
int av;
void add(string s) {
  int p = 0;
  for (int i = 0; i < s.size(); i++) {
    int id = s[i] - 'a';
    if (T[p].in[id] == -1) T[p].in[id] = ++av;
    p = T[p].in[id];
  }
}
int dp[MX], dp2[MX];
void dfs(int x) {
  bool flg = 0, flg2 = 0;
  int cn = 0, cn2 = 0;
  for (int i = 0; i < 26; i++) {
    if (T[x].in[i] != -1) {
      flg2 = 1;
      cn++;
      dfs(T[x].in[i]);
      if (dp[T[x].in[i]] == 0) cn2++;
    }
  }
  if (cn == cn2)
    dp[x] = 1;
  else
    dp[x] = 0;
  if (!flg2) dp[x] = 1;
}
void dfs2(int x) {
  bool flg2 = 0, flg = 0;
  int cn = 0, cn2 = 0;
  for (int i = 0; i < 26; i++) {
    if (T[x].in[i] != -1) {
      flg2 = 1;
      cn++;
      dfs2(T[x].in[i]);
      if (dp2[T[x].in[i]] == 1) cn2++;
    }
  }
  if (cn == cn2)
    dp2[x] = 0;
  else
    dp2[x] = 1;
  if (!flg2) dp2[x] = 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  memset(T, -1, sizeof(T));
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    add(s);
  }
  dfs(0);
  dfs2(0);
  bool flg = 0, flg2 = 0;
  for (int i = 0; i < 26; i++)
    if (T[0].in[i] != -1)
      flg |= (dp[T[0].in[i]]), flg2 |= (dp2[T[0].in[i]] == 0);
  if (flg == 0)
    cout << "Second" << endl;
  else {
    if (flg2 || k & 1)
      cout << "First" << endl;
    else
      cout << "Second" << endl;
  }
  return 0;
}

```


### Prompt

Please formulate a Cpp solution to the following problem:

problem

You are looking for a constellation in a picture of the starry sky. The photo always contains exactly one figure with the same shape, orientation, and size as the constellation you are looking for. However, there is a possibility that extra stars are shown in the photograph other than the stars that make up the constellation.

For example, the constellations in Figure 1 are included in the photo in Figure 2 (circled). If you translate the coordinates of a star in a given constellation by 2 in the x direction and −3 in the y direction, it will be the position in the photo.

Given the shape of the constellation you want to look for and the position of the star in the picture, write a program that answers the amount to translate to convert the coordinates of the constellation to the coordinates in the picture.

<image> | <image>
--- | ---
Figure 1: The constellation you want to find | Figure 2: Photograph of the starry sky

input

The input consists of multiple datasets. Each dataset is given in the following format.

The first line of the input contains the number of stars m that make up the constellation you want to find. In the following m line, the integers indicating the x and y coordinates of the m stars that make up the constellation you want to search for are written separated by blanks. The number n of stars in the photo is written on the m + 2 line. In the following n lines, the integers indicating the x and y coordinates of the n stars in the photo are written separated by blanks.

The positions of the m stars that make up the constellation are all different. Also, the positions of the n stars in the picture are all different. 1 ≤ m ≤ 200, 1 ≤ n ≤ 1000. The x and y coordinates of a star are all 0 or more and 1000000 or less.

When m is 0, it indicates the end of input. The number of datasets does not exceed 5.

output

The output of each dataset consists of one line, with two integers separated by blanks. These show how much the coordinates of the constellation you want to find should be translated to become the coordinates in the photo. The first integer is the amount to translate in the x direction, and the second integer is the amount to translate in the y direction.

Examples

Input

5
8 5
6 4
4 3
7 10
0 10
10
10 5
2 7
9 7
8 10
10 2
1 2
8 1
6 7
6 0
0 9
5
904207 809784
845370 244806
499091 59863
638406 182509
435076 362268
10
757559 866424
114810 239537
519926 989458
461089 424480
674361 448440
81851 150384
459107 795405
299682 6700
254125 362183
50795 541942
0

Output

2 -3
-384281 179674

Input

None

Output

None

### Response

```cpp
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <utility>
using namespace std;

int main(){
	int m, n;
	pair<int, int> p1[202];
	pair<int, int> p2[1002];
	while(cin >> m, m){
		fill(p1, p1+202, make_pair(-1, -1));
		fill(p2, p2+1002, make_pair(-1, -1));
		for(int i = 0;i < m;i++)cin >> p1[i].first >> p1[i].second;
		cin >> n;
		for(int i = 0;i < n;i++)cin >> p2[i].first >> p2[i].second;

		sort(p1, p1+m);
		sort(p2, p2+n);
		pair<int, int> t;
		int ans[3] = {0, 0, 0};
		for(int i = 0;i < n;i++){
			ans[0] = 0;
			for(int j = 1;j < m;j++){
				t.first = p2[i].first+(p1[j].first-p1[0].first);
				t.second = p2[i].second+(p1[j].second-p1[0].second);
				ans[0] += binary_search(p2, p2+n, t);
			}
			if(ans[0] == m-1){
				ans[1] = p2[i].first - p1[0].first;
				ans[2] = p2[i].second - p1[0].second;
			}

		}
		cout << ans[1] << " " << ans[2] << endl;
	}
	return 0;
}
```


### Prompt

Your task is to create a cpp solution to the following problem:

problem

Hanako is playing with n (4 ≤ n ≤ 10) cards side by side. Each card has one integer between 1 and 99. Hanako chose k cards (2 ≤ k ≤ 4) from these cards and arranged them in a horizontal row to make an integer. How many kinds of integers can Hanako make in total?

For example, consider that you are given five cards of 1, 2, 3, 13, 21 and choose three of them to make an integer. By arranging 2, 1, and 13 in this order, we can make an integer 2113. Also, by arranging 21, 1, and 3 in this order, the same integer 2113 can be created. In this way, the same integer may be created from a combination of different cards.

Given the integers written on n cards, create a program to find the number of integers that can be created by selecting k cards from them and arranging them in a horizontal row.

input

The input consists of multiple datasets. Each dataset is given in the following format.

Each dataset consists of 2 + n rows. The number of cards n (4 ≤ n ≤ 10) is written on the first line, and the number of cards to be selected k (2 ≤ k ≤ 4) is written on the second line. On the 2 + i line (1 ≤ i ≤ n), the integer from 1 to 99 written on the i-th card is written.

When both n and k are 0, it indicates the end of input. The number of data sets does not exceed 5.

output

For each data set, the number of integers that Hanako can create is output on one line.

Examples

Input

4
2
1
2
12
1
6
3
72
2
12
7
2
1
0
0

Output

7
68

Input

None

Output

None

### Response

```cpp
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int to_i(string s){
  int k=1,res=0;
  for(int i=s.size()-1;i>=0;i--){
    res+=(s[i]-'0')*k;
    k*=10;
  }
}
int main(){
  int n,k;
  while(cin>>n>>k&&n&&k){
    string a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    set<string> f;
    int ans=0;
    for(int i=0;i<1<<n;i++){
      int c=0;
      vector<string> t;
      for(int j=0;j<n;j++)if((i>>j)&1){
          c++;t.PB(a[j]);
      }
      if(c!=k)continue;
      sort(t.begin(),t.end());
      do{
        string res="";
        for(int j=0;j<t.size();j++)res+=t[j];
        if(f.count(res)==0){
          ans++;
          f.insert(res);
        }
      }while(next_permutation(t.begin(),t.end()));
    }
    cout<<f.size()<<endl;
  }
}
```


### Prompt

Your task is to create a CPP solution to the following problem:

Polycarp found n segments on the street. A segment with the index i is described by two integers l_i and r_i — coordinates of the beginning and end of the segment, respectively. Polycarp realized that he didn't need all the segments, so he wanted to delete some of them.

Polycarp believes that a set of k segments is good if there is a segment [l_i, r_i] (1 ≤ i ≤ k) from the set, such that it intersects every segment from the set (the intersection must be a point or segment). For example, a set of 3 segments [[1, 4], [2, 3], [3, 6]] is good, since the segment [2, 3] intersects each segment from the set. Set of 4 segments [[1, 2], [2, 3], [3, 5], [4, 5]] is not good.

Polycarp wonders, what is the minimum number of segments he has to delete so that the remaining segments form a good set?

Input

The first line contains a single integer t (1 ≤ t ≤ 2 ⋅ 10^5) — number of test cases. Then t test cases follow.

The first line of each test case contains a single integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the number of segments. This is followed by n lines describing the segments.

Each segment is described by two integers l and r (1 ≤ l ≤ r ≤ 10^9) — coordinates of the beginning and end of the segment, respectively.

It is guaranteed that the sum of n for all test cases does not exceed 2 ⋅ 10^5.

Output

For each test case, output a single integer — the minimum number of segments that need to be deleted in order for the set of remaining segments to become good.

Example

Input

4
3
1 4
2 3
3 6
4
1 2
2 3
3 5
4 5
5
1 2
3 8
4 5
6 7
9 10
5
1 5
2 4
3 5
3 8
4 8

Output

0
1
2
0

### Response

```cpp
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
#define S second
#define F first
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;

void setIO(string name = "") {
	ios_base::sync_with_stdio(NULL);
	cin.tie(NULL);
	cout.tie(NULL);

	if (sz(name)) {
		freopen((name + ".in").c_str(), "r", stdin);
		freopen((name + ".out").c_str(), "w", stdout);
	}
}

const int inf = 1e9;
const ll INF = 1e18;
const int mod = 1e9 + 7;
const int MAXN = 5e5 + 5;

int n;
int l[MAXN], r[MAXN];
int pref[MAXN], suff[MAXN];

void solve() {
	cin >> n;

	vector<int> v;
	for (int i = 1; i <= n; i++) {
		cin >> l[i] >> r[i];
		v.pb(l[i]);
		v.pb(r[i]);
	}

	sort (all(v));
	v.erase(unique(all(v)), v.end());

	for (int i = 1; i <= n; i++) {
		l[i] = lower_bound(all(v), l[i]) - v.begin() + 1;
		r[i] = lower_bound(all(v), r[i]) - v.begin() + 1;
	}

	for (int i = 0; i <= sz(v) + 1; i++) {
		pref[i] = 0;
		suff[i] = 0;
	}

	for (int i = 1; i <= n; i++) {
		pref[r[i] + 1]++;
		suff[l[i] - 1]++;
	}

	for (int i = 1; i <= sz(v); i++) {
		pref[i] += pref[i - 1];
	}

	for (int i = sz(v); i >= 1; i--) {
		suff[i] += suff[i + 1];
	}

	int res = inf;
	for (int i = 1; i <= n; i++) {
		int ct = pref[l[i]] + suff[r[i]];
		res = min(res, ct);
	}

	cout << res << '\n';
}

int main() {
	setIO();

	int tt = 1;
	cin >> tt;
	while (tt--) {
		solve();
	}

	return 0;
}

```


### Prompt

Please formulate a Cpp solution to the following problem:

A string s of length n (1 ≤ n ≤ 26) is called alphabetical if it can be obtained using the following algorithm:

  * first, write an empty string to s (i.e. perform the assignment s := "");
  * then perform the next step n times;
  * at the i-th step take i-th lowercase letter of the Latin alphabet and write it either to the left of the string s or to the right of the string s (i.e. perform the assignment s := c+s or s := s+c, where c is the i-th letter of the Latin alphabet).

In other words, iterate over the n first letters of the Latin alphabet starting from 'a' and etc. Each time we prepend a letter to the left of the string s or append a letter to the right of the string s. Strings that can be obtained in that way are alphabetical.

For example, the following strings are alphabetical: "a", "ba", "ab", "bac" and "ihfcbadeg". The following strings are not alphabetical: "z", "aa", "ca", "acb", "xyz" and "ddcba".

From the given string, determine if it is alphabetical.

Input

The first line contains one integer t (1 ≤ t ≤ 10^4) — the number of test cases. Then t test cases follow.

Each test case is written on a separate line that contains one string s. String s consists of lowercase letters of the Latin alphabet and has a length between 1 and 26, inclusive.

Output

Output t lines, each of them must contain the answer to the corresponding test case. Output YES if the given string s is alphabetical and NO otherwise.

You can output YES and NO in any case (for example, strings yEs, yes, Yes and YES will be recognized as a positive answer).

Example

Input

11
a
ba
ab
bac
ihfcbadeg
z
aa
ca
acb
xyz
ddcba

Output

YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO

Note

The example contains test cases from the main part of the condition.

### Response

```cpp
#include<iostream>
#include<vector>
#include<deque>
#include<algorithm>
#include<map>
#include<array>
#include<utility>
#include<cmath>
#include<queue>
#include<string>
#include<assert.h>

#define MAX64 0x7fffffffffffffff
#define MAX32 0x7fffffff

typedef int_fast64_t ll;
typedef int_fast64_t i64;
typedef int_fast32_t i32;

int main (){
    std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    i32 test_cases;
    std::cin>> test_cases;
    while(test_cases--){
        std::string s;
        std::cin >> s;

        i32 loc_of_a = 0;
        for(i32 i = 0; i < s.size(); i++){
            if(s[i] == 'a') loc_of_a = i;
        }

        char current = 'a'; i32 l = loc_of_a, r = loc_of_a + 1; bool suffice = true;
        while(current <= 'a' + s.size() - 1){
            if(l >= 0 && s[l] == current){
                l -= 1;
                current += 1;
                continue;
            }

            if(r < s.size() && s[r] == current){
                r += 1;
                current += 1;
                continue;
            }

            suffice = false;
            break;
        }

        if(suffice) std::cout <<"YES\n";
        else std::cout << "NO\n";
    }
}
```


### Prompt

Please create a solution in CPP to the following problem:

Little Mishka is a great traveller and she visited many countries. After thinking about where to travel this time, she chose XXX — beautiful, but little-known northern country.

Here are some interesting facts about XXX:

  1. XXX consists of n cities, k of whose (just imagine!) are capital cities.
  2. All of cities in the country are beautiful, but each is beautiful in its own way. Beauty value of i-th city equals to ci.
  3. All the cities are consecutively connected by the roads, including 1-st and n-th city, forming a cyclic route 1 — 2 — ... — n — 1. Formally, for every 1 ≤ i < n there is a road between i-th and i + 1-th city, and another one between 1-st and n-th city.
  4. Each capital city is connected with each other city directly by the roads. Formally, if city x is a capital city, then for every 1 ≤ i ≤ n, i ≠ x, there is a road between cities x and i.
  5. There is at most one road between any two cities.
  6. Price of passing a road directly depends on beauty values of cities it connects. Thus if there is a road between cities i and j, price of passing it equals ci·cj.

Mishka started to gather her things for a trip, but didn't still decide which route to follow and thus she asked you to help her determine summary price of passing each of the roads in XXX. Formally, for every pair of cities a and b (a < b), such that there is a road between a and b you are to find sum of products ca·cb. Will you help her?

Input

The first line of the input contains two integers n and k (3 ≤ n ≤ 100 000, 1 ≤ k ≤ n) — the number of cities in XXX and the number of capital cities among them.

The second line of the input contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 10 000) — beauty values of the cities.

The third line of the input contains k distinct integers id1, id2, ..., idk (1 ≤ idi ≤ n) — indices of capital cities. Indices are given in ascending order.

Output

Print the only integer — summary price of passing each of the roads in XXX.

Examples

Input

4 1
2 3 1 2
3

Output

17

Input

5 2
3 5 2 2 4
1 4

Output

71

Note

This image describes first sample case:

<image>

It is easy to see that summary price is equal to 17.

This image describes second sample case:

<image>

It is easy to see that summary price is equal to 71.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long int isCap[100005], capitals[100005], beauty[100005];
int main() {
  long long int n, cap;
  long long int i, j;
  cin >> n >> cap;
  for (i = 0; i < n; i++) cin >> beauty[i];
  for (i = 0; i < cap; i++) {
    cin >> j;
    j--;
    capitals[i] = j;
    isCap[j] = 1;
  }
  long long int sum = 0, ans = 0;
  for (i = 0; i < n - 1; i++)
    if (!(isCap[i] && isCap[i + 1])) ans += beauty[i] * beauty[i + 1];
  if (!(isCap[0] && isCap[n - 1])) ans += beauty[0] * beauty[n - 1];
  for (i = 0; i < n; i++)
    if (isCap[i] == 0) sum += beauty[i];
  for (i = 0; i < cap; i++) {
    long long int neigh1 = (capitals[i] + 1) % n,
                  neigh2 = (capitals[i] - 1 + n) % n;
    long long int tempSum = sum;
    if (isCap[neigh1] == 0) tempSum -= beauty[neigh1];
    if (isCap[neigh2] == 0) tempSum -= beauty[neigh2];
    ans += tempSum * beauty[capitals[i]];
  }
  long long int sumCapitals = 0;
  for (i = 0; i < cap; i++) {
    sumCapitals += beauty[capitals[i]];
  }
  for (i = 0; i < cap; i++) {
    sumCapitals -= beauty[capitals[i]];
    ans += sumCapitals * beauty[capitals[i]];
  }
  cout << ans;
  return 0;
}

```


### Prompt

Generate a CPP solution to the following problem:

Some natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It's known that the length of the number didn't change.

You have to find the minimum number of digits in which these two numbers can differ.

Input

The first line contains integer k (1 ≤ k ≤ 109).

The second line contains integer n (1 ≤ n < 10100000).

There are no leading zeros in n. It's guaranteed that this situation is possible.

Output

Print the minimum number of digits in which the initial number and n can differ.

Examples

Input

3
11

Output

1

Input

3
99

Output

0

Note

In the first example, the initial number could be 12.

In the second example the sum of the digits of n is not less than k. The initial number could be equal to n.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int k;
char s[100010];
int a[100010];
int main() {
  cin >> k;
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 0; i < len; i++) {
    a[i] = s[i] - '0';
    k -= a[i];
    a[i] = 9 - a[i];
  }
  sort(a, a + len);
  int ans = 0;
  for (int i = len - 1; i >= 0; i--) {
    if (k > 0)
      k -= a[i], ans++;
    else
      break;
  }
  cout << ans;
  return 0;
}

```


### Prompt

Please create a solution in Cpp to the following problem:

Little C loves number «3» very much. He loves all things about it.

Now he has a positive integer n. He wants to split n into 3 positive integers a,b,c, such that a+b+c=n and none of the 3 integers is a multiple of 3. Help him to find a solution.

Input

A single line containing one integer n (3 ≤ n ≤ 10^9) — the integer Little C has.

Output

Print 3 positive integers a,b,c in a single line, such that a+b+c=n and none of them is a multiple of 3.

It can be proved that there is at least one solution. If there are multiple solutions, print any of them.

Examples

Input

3

Output

1 1 1

Input

233

Output

77 77 79

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
void e(int l) {
  if ((l - 2) % 3 != 0)
    cout << "1 1 " << l - 2;
  else
    cout << "1 2 " << l - 3;
}
int main() {
  int k;
  cin >> k;
  e(k);
  return 0;
}

```


### Prompt

Construct a cpp code solution to the problem outlined:

There are N men and N women, both numbered 1, 2, \ldots, N.

For each i, j (1 \leq i, j \leq N), the compatibility of Man i and Woman j is given as an integer a_{i, j}. If a_{i, j} = 1, Man i and Woman j are compatible; if a_{i, j} = 0, they are not.

Taro is trying to make N pairs, each consisting of a man and a woman who are compatible. Here, each man and each woman must belong to exactly one pair.

Find the number of ways in which Taro can make N pairs, modulo 10^9 + 7.

Constraints

* All values in input are integers.
* 1 \leq N \leq 21
* a_{i, j} is 0 or 1.

Input

Input is given from Standard Input in the following format:

N
a_{1, 1} \ldots a_{1, N}
:
a_{N, 1} \ldots a_{N, N}

Output

Print the number of ways in which Taro can make N pairs, modulo 10^9 + 7.

Examples

Input

3
0 1 1
1 0 1
1 1 1

Output

3

Input

4
0 1 0 0
0 0 0 1
1 0 0 0
0 0 1 0

Output

1

Input

1
0

Output

0

Input

21
0 0 0 0 0 0 0 1 1 0 1 1 1 1 0 0 0 1 0 0 1
1 1 1 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 1 1 0
0 0 1 1 1 1 0 1 1 0 0 1 0 0 1 1 0 0 0 1 1
0 1 1 0 1 1 0 1 0 1 0 0 1 0 0 0 0 0 1 1 0
1 1 0 0 1 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0
0 1 1 0 1 1 1 0 1 1 1 0 0 0 1 1 1 1 0 0 1
0 1 0 0 0 1 0 1 0 0 0 1 1 1 0 0 1 1 0 1 0
0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 1 1 1 1 1 1
0 0 1 0 0 1 0 0 1 0 1 1 0 0 1 0 1 0 1 1 1
0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1
0 1 1 0 1 1 0 0 1 1 0 0 0 1 1 1 1 0 1 1 0
0 0 1 0 0 1 1 1 1 0 1 1 0 1 1 1 0 0 0 0 1
0 1 1 0 0 1 1 1 1 0 0 0 1 0 1 1 0 1 0 1 1
1 1 1 1 1 0 0 0 0 1 0 0 1 1 0 1 1 1 0 0 1
0 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1
1 0 1 1 0 1 0 1 0 0 1 0 0 1 1 0 1 0 1 1 0
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1
0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 0 0 1 1 0 1
0 0 0 0 1 1 1 0 1 0 1 1 1 0 1 1 0 0 1 1 0
1 1 0 1 1 0 0 1 1 0 1 1 0 1 1 1 1 1 0 1 0
1 0 0 1 1 0 1 1 1 1 1 0 1 0 1 1 0 0 0 0 0

Output

102515160

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
int n,dp[4200003];
bool a[22][22];
int main(){
	cin>>n;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			cin>>a[i][j];
	dp[0]=1;
	for(int i=0;i<1<<n;i++){
		int cnt=0,tmp=i;
		while(tmp)
			cnt+=tmp%2,
			tmp/=2;
		//cout<<i<<' '<<cnt<<endl;
		for(int j=0;j<n;j++)
			if(a[cnt][j]&&~i&(1<<j))
				dp[i+(1<<j)]=(dp[i+(1<<j)]+dp[i])%1000000007;
	}
	cout<<dp[(1<<n)-1];
}
```


### Prompt

Your challenge is to write a cpp solution to the following problem:

Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.

In total there are n piles of boxes, arranged in a line, from left to right, i-th pile (1 ≤ i ≤ n) containing ai boxes. Luckily, m students are willing to help GukiZ by removing all the boxes from his way. Students are working simultaneously. At time 0, all students are located left of the first pile. It takes one second for every student to move from this position to the first pile, and after that, every student must start performing sequence of two possible operations, each taking one second to complete. Possible operations are:

  1. If i ≠ n, move from pile i to pile i + 1;
  2. If pile located at the position of student is not empty, remove one box from it.

GukiZ's students aren't smart at all, so they need you to tell them how to remove boxes before professor comes (he is very impatient man, and doesn't want to wait). They ask you to calculate minumum time t in seconds for which they can remove all the boxes from GukiZ's way. Note that students can be positioned in any manner after t seconds, but all the boxes must be removed.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 105), the number of piles of boxes and the number of GukiZ's students.

The second line contains n integers a1, a2, ... an (0 ≤ ai ≤ 109) where ai represents the number of boxes on i-th pile. It's guaranteed that at least one pile of is non-empty.

Output

In a single line, print one number, minimum time needed to remove all the boxes in seconds.

Examples

Input

2 1
1 1

Output

4

Input

3 2
1 0 2

Output

5

Input

4 100
3 4 5 4

Output

5

Note

First sample: Student will first move to the first pile (1 second), then remove box from first pile (1 second), then move to the second pile (1 second) and finally remove the box from second pile (1 second).

Second sample: One of optimal solutions is to send one student to remove a box from the first pile and a box from the third pile, and send another student to remove a box from the third pile. Overall, 5 seconds.

Third sample: With a lot of available students, send three of them to remove boxes from the first pile, four of them to remove boxes from the second pile, five of them to remove boxes from the third pile, and four of them to remove boxes from the fourth pile. Process will be over in 5 seconds, when removing the boxes from the last pile is finished.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, a[N];
int check(long long t) {
  int cnt = m;
  long long canmove = 0;
  for (int i = n; i >= 1; --i) {
    while (canmove < a[i]) {
      canmove += t - i;
      if (--cnt < 0) return 0;
    }
    canmove -= a[i];
  }
  return 1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
  }
  long long l = 0, r = 1LL << 60, res;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (check(mid)) {
      res = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  printf("%I64d\n", res);
  return 0;
}

```