#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 11, mod = 1e9 + 7;
int f[N], g[N], a[N], b[N], c[N], d[N], fac[N], ifac[N], ik[N], ik0[N];
int n, s, ans, cnt, k, m;
int fp(int a, int b) {
  int res = 1;
  for (; b; b >>= 1, a = 1ll * a * a % mod)
    if (b & 1) res = 1ll * res * a % mod;
  return res;
}
int C(int n, int m) { return 1ll * fac[n] * ifac[m] % mod * ifac[n - m] % mod; }
int main() {
  scanf("%d%d", &n, &k);
  fac[0] = 1;
  for (int i = (1); i <= (n); i++) fac[i] = 1ll * fac[i - 1] * i % mod;
  for (int i = (0); i <= (n); i++) ifac[i] = fp(fac[i], mod - 2);
  ik[0] = ik0[0] = 1;
  for (int i = (1); i <= (n); i++) {
    ik[i] = 1ll * ik[i - 1] * fp(k, mod - 2) % mod,
    ik0[i] = 1ll * ik0[i - 1] * (1 - fp(k, mod - 2)) % mod;
  }
  s = n;
  for (int i = (1); i <= (n); i++) {
    scanf("%d", a + i);
    if (a[i] == -1) {
      --i;
      --n;
      ++cnt;
      continue;
    }
    b[i] = a[i];
  }
  sort(b + 1, b + n + 1);
  m = unique(b + 1, b + n + 1) - b - 1;
  int p = 0;
  for (int i = (1); i <= (n); i++) {
    a[i] = lower_bound(b + 1, b + m + 1, a[i]) - b;
    if (!c[a[i]]) ++p;
    ++c[a[i]];
  }
  n = k;
  g[0] = n;
  for (int i = (1); i <= (s - 1); i++)
    g[i] = 1ll * fp(s - i, mod - 2) *
           (1ll * s * n % mod + 1ll * i * (n - 1) % mod * g[i - 1] % mod) % mod;
  f[s] = 0;
  for (int i = s - 1; ~i; --i) f[i] = (f[i + 1] + g[i]) % mod;
  for (int i = (1); i <= (p); i++) ++d[c[i]];
  d[0] = n - m;
  for (int i = (0); i <= (s); i++) {
    if (d[i] > 0) {
      for (int j = (0); j <= (cnt); j++)
        ans = (ans + 1ll * d[i] * f[i + j] % mod * C(cnt, j) % mod * ik[j] %
                         mod * ik0[cnt - j]) %
              mod;
    }
  }
  ans = 1ll * (ans - 1ll * f[0] * (n - 1)) % mod * fp(n, mod - 2) % mod;
  ans = (ans + mod) % mod;
  printf("%d\n", ans);
  return 0;
}

### Prompt

Please provide a Cpp coded solution to the problem described below:

Mr. Chanek opened a letter from his fellow, who is currently studying at Singanesia. Here is what it says.

Define an array b (0 ≤ b_i < k) with n integers. While there exists a pair (i, j) such that b_i ≠ b_j, do the following operation:

  * Randomly pick a number i satisfying 0 ≤ i < n. Note that each number i has a probability of 1/n to be picked. 
  * Randomly Pick a number j satisfying 0 ≤ j < k. 
  * Change the value of b_i to j. It is possible for b_i to be changed to the same value. 



Denote f(b) as the expected number of operations done to b until all elements of b are equal. 

You are given two integers n and k, and an array a (-1 ≤ a_i < k) of n integers. 

For every index i with a_i = -1, replace a_i with a random number j satisfying 0 ≤ j < k. Let c be the number of occurrences of -1 in a. There are k^c possibilites of a after the replacement, each with equal probability of being the final array.

Find the expected value of f(a) modulo 10^9 + 7. 

Formally, let M = 10^9 + 7. It can be shown that the answer can be expressed as an irreducible fraction p/q, where p and q are integers and q not ≡ 0 \pmod{M}. Output the integer equal to p ⋅ q^{-1} mod M. In other words, output such an integer x that 0 ≤ x < M and x ⋅ q ≡ p \pmod{M}.

After reading the letter, Mr. Chanek gave the task to you. Solve it for the sake of their friendship!

Input

The first line contains two integers n and k (2 ≤ n ≤ 10^5, 2 ≤ k ≤ 10^9). 

The second line contains n integers a_1, a_2, …, a_n (-1 ≤ a_i < k).

Output

Output an integer denoting the expected value of f(a) modulo 10^9 + 7.

Examples

Input


2 2
0 1


Output


2


Input


2 2
0 -1


Output


1


Input


3 3
0 1 1


Output


12


Input


3 3
-1 -1 -1


Output


11


Input


10 9
-1 0 -1 1 1 2 2 3 3 3


Output


652419213

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 11, mod = 1e9 + 7;
int f[N], g[N], a[N], b[N], c[N], d[N], fac[N], ifac[N], ik[N], ik0[N];
int n, s, ans, cnt, k, m;
int fp(int a, int b) {
  int res = 1;
  for (; b; b >>= 1, a = 1ll * a * a % mod)
    if (b & 1) res = 1ll * res * a % mod;
  return res;
}
int C(int n, int m) { return 1ll * fac[n] * ifac[m] % mod * ifac[n - m] % mod; }
int main() {
  scanf("%d%d", &n, &k);
  fac[0] = 1;
  for (int i = (1); i <= (n); i++) fac[i] = 1ll * fac[i - 1] * i % mod;
  for (int i = (0); i <= (n); i++) ifac[i] = fp(fac[i], mod - 2);
  ik[0] = ik0[0] = 1;
  for (int i = (1); i <= (n); i++) {
    ik[i] = 1ll * ik[i - 1] * fp(k, mod - 2) % mod,
    ik0[i] = 1ll * ik0[i - 1] * (1 - fp(k, mod - 2)) % mod;
  }
  s = n;
  for (int i = (1); i <= (n); i++) {
    scanf("%d", a + i);
    if (a[i] == -1) {
      --i;
      --n;
      ++cnt;
      continue;
    }
    b[i] = a[i];
  }
  sort(b + 1, b + n + 1);
  m = unique(b + 1, b + n + 1) - b - 1;
  int p = 0;
  for (int i = (1); i <= (n); i++) {
    a[i] = lower_bound(b + 1, b + m + 1, a[i]) - b;
    if (!c[a[i]]) ++p;
    ++c[a[i]];
  }
  n = k;
  g[0] = n;
  for (int i = (1); i <= (s - 1); i++)
    g[i] = 1ll * fp(s - i, mod - 2) *
           (1ll * s * n % mod + 1ll * i * (n - 1) % mod * g[i - 1] % mod) % mod;
  f[s] = 0;
  for (int i = s - 1; ~i; --i) f[i] = (f[i + 1] + g[i]) % mod;
  for (int i = (1); i <= (p); i++) ++d[c[i]];
  d[0] = n - m;
  for (int i = (0); i <= (s); i++) {
    if (d[i] > 0) {
      for (int j = (0); j <= (cnt); j++)
        ans = (ans + 1ll * d[i] * f[i + j] % mod * C(cnt, j) % mod * ik[j] %
                         mod * ik0[cnt - j]) %
              mod;
    }
  }
  ans = 1ll * (ans - 1ll * f[0] * (n - 1)) % mod * fp(n, mod - 2) % mod;
  ans = (ans + mod) % mod;
  printf("%d\n", ans);
  return 0;
}

```