#include <bits/stdc++.h>
using namespace std;
constexpr long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-8;
const long double pi = acosl(-1.0);
long long mod_pow(long long x, long long n, long long m = mod) {
  if (n < 0) {
    long long res = mod_pow(x, -n, m);
    return mod_pow(res, m - 2, m);
  }
  if (abs(x) >= m) x %= m;
  if (x < 0) x += m;
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return res;
}
struct modint {
  long long n;
  modint() : n(0) { ; }
  modint(long long m) : n(m) {
    if (n >= mod)
      n %= mod;
    else if (n < 0)
      n = (n % mod + mod) % mod;
  }
  operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) {
  a.n += b.n;
  if (a.n >= mod) a.n -= mod;
  return a;
}
modint operator-=(modint& a, modint b) {
  a.n -= b.n;
  if (a.n < 0) a.n += mod;
  return a;
}
modint operator*=(modint& a, modint b) {
  a.n = ((long long)a.n * b.n) % mod;
  return a;
}
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, long long n) {
  if (n == 0) return modint(1);
  modint res = (a * a) ^ (n / 2);
  if (n % 2) res = res * a;
  return res;
}
long long inv(long long a, long long p) {
  return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
modint operator/=(modint& a, modint b) {
  a = a / b;
  return a;
}
const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
  fact[0] = modint(1);
  for (int i = 0; i < max_n - 1; i++) {
    fact[i + 1] = fact[i] * modint(i + 1);
  }
  factinv[max_n - 1] = modint(1) / fact[max_n - 1];
  for (int i = max_n - 2; i >= 0; i--) {
    factinv[i] = factinv[i + 1] * modint(i + 1);
  }
}
modint comb(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[b] * factinv[a - b];
}
modint combP(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[a - b];
}
using mP = pair<modint, modint>;
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort((a).begin(), (a).end());
  vector<mP> memo(n);
  memo[0] = {1, 0};
  for (int c = 0; c <= n - 2; c++) {
    modint A = (long long)n * k - c - (long long)(n - c) * (k - 1);
    modint B = -(long long)c * (k - 1);
    modint x = A * memo[c].first;
    if (c > 0) x += B * memo[c - 1].first;
    modint y = A * memo[c].second;
    if (c > 0) y += B * memo[c - 1].second;
    y -= (long long)n * k;
    x /= n - c;
    y /= n - c;
    memo[c + 1] = {x, y};
  }
  int c = n - 1;
  modint A = (long long)n * k - c - (long long)(n - c) * (k - 1);
  modint B = -(long long)c * (k - 1);
  modint x = A * memo[c].first;
  if (c > 0) x += B * memo[c - 1].first;
  modint y = A * memo[c].second;
  if (c > 0) y += B * memo[c - 1].second;
  y -= (long long)n * k;
  vector<modint> ex(n);
  ex[0] = (modint)-y / x;
  for (int c = 1; c < n; c++) {
    ex[c] = memo[c].first * ex[0] + memo[c].second;
  }
  int ad = 0;
  vector<int> cs;
  int rest = k;
  for (int i = 0; i < n; i++) {
    int le = i;
    while (i + 1 < n && a[i] == a[i + 1]) i++;
    int len = i - le + 1;
    if (a[i] < 0) {
      ad = len;
    } else {
      rest--;
      cs.push_back(len);
    }
  }
  sort((cs).begin(), (cs).end());
  vector<pair<int, int> > ps;
  for (int i = 0; i < cs.size(); i++) {
    int le = i;
    while (i + 1 < cs.size() && cs[i] == cs[i + 1]) i++;
    int cnt = i - le + 1;
    ps.push_back({cs[i], cnt});
  }
  ps.push_back({0, rest});
  modint ans = 0;
  vector<modint> coef(ad + 1);
  for (int i = 0; i < ad + 1; i++) {
    coef[i] = comb(ad, i) * (modint)mod_pow(k - 1, ad - i);
  }
  ex.push_back(0);
  for (pair<int, int> p : ps) {
    for (int i = 0; i <= ad; i++) {
      modint val = ex[p.first + i];
      val *= p.second;
      ans += val * coef[i];
    }
  }
  ans -= (modint)(k - 1) * ex[0] * (modint)mod_pow(k, ad);
  ans /= k;
  ans /= mod_pow(k, ad);
  cout << ans << "\n";
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  init_f();
  solve();
  return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

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;
constexpr long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-8;
const long double pi = acosl(-1.0);
long long mod_pow(long long x, long long n, long long m = mod) {
  if (n < 0) {
    long long res = mod_pow(x, -n, m);
    return mod_pow(res, m - 2, m);
  }
  if (abs(x) >= m) x %= m;
  if (x < 0) x += m;
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return res;
}
struct modint {
  long long n;
  modint() : n(0) { ; }
  modint(long long m) : n(m) {
    if (n >= mod)
      n %= mod;
    else if (n < 0)
      n = (n % mod + mod) % mod;
  }
  operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) {
  a.n += b.n;
  if (a.n >= mod) a.n -= mod;
  return a;
}
modint operator-=(modint& a, modint b) {
  a.n -= b.n;
  if (a.n < 0) a.n += mod;
  return a;
}
modint operator*=(modint& a, modint b) {
  a.n = ((long long)a.n * b.n) % mod;
  return a;
}
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, long long n) {
  if (n == 0) return modint(1);
  modint res = (a * a) ^ (n / 2);
  if (n % 2) res = res * a;
  return res;
}
long long inv(long long a, long long p) {
  return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
modint operator/=(modint& a, modint b) {
  a = a / b;
  return a;
}
const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
  fact[0] = modint(1);
  for (int i = 0; i < max_n - 1; i++) {
    fact[i + 1] = fact[i] * modint(i + 1);
  }
  factinv[max_n - 1] = modint(1) / fact[max_n - 1];
  for (int i = max_n - 2; i >= 0; i--) {
    factinv[i] = factinv[i + 1] * modint(i + 1);
  }
}
modint comb(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[b] * factinv[a - b];
}
modint combP(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[a - b];
}
using mP = pair<modint, modint>;
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort((a).begin(), (a).end());
  vector<mP> memo(n);
  memo[0] = {1, 0};
  for (int c = 0; c <= n - 2; c++) {
    modint A = (long long)n * k - c - (long long)(n - c) * (k - 1);
    modint B = -(long long)c * (k - 1);
    modint x = A * memo[c].first;
    if (c > 0) x += B * memo[c - 1].first;
    modint y = A * memo[c].second;
    if (c > 0) y += B * memo[c - 1].second;
    y -= (long long)n * k;
    x /= n - c;
    y /= n - c;
    memo[c + 1] = {x, y};
  }
  int c = n - 1;
  modint A = (long long)n * k - c - (long long)(n - c) * (k - 1);
  modint B = -(long long)c * (k - 1);
  modint x = A * memo[c].first;
  if (c > 0) x += B * memo[c - 1].first;
  modint y = A * memo[c].second;
  if (c > 0) y += B * memo[c - 1].second;
  y -= (long long)n * k;
  vector<modint> ex(n);
  ex[0] = (modint)-y / x;
  for (int c = 1; c < n; c++) {
    ex[c] = memo[c].first * ex[0] + memo[c].second;
  }
  int ad = 0;
  vector<int> cs;
  int rest = k;
  for (int i = 0; i < n; i++) {
    int le = i;
    while (i + 1 < n && a[i] == a[i + 1]) i++;
    int len = i - le + 1;
    if (a[i] < 0) {
      ad = len;
    } else {
      rest--;
      cs.push_back(len);
    }
  }
  sort((cs).begin(), (cs).end());
  vector<pair<int, int> > ps;
  for (int i = 0; i < cs.size(); i++) {
    int le = i;
    while (i + 1 < cs.size() && cs[i] == cs[i + 1]) i++;
    int cnt = i - le + 1;
    ps.push_back({cs[i], cnt});
  }
  ps.push_back({0, rest});
  modint ans = 0;
  vector<modint> coef(ad + 1);
  for (int i = 0; i < ad + 1; i++) {
    coef[i] = comb(ad, i) * (modint)mod_pow(k - 1, ad - i);
  }
  ex.push_back(0);
  for (pair<int, int> p : ps) {
    for (int i = 0; i <= ad; i++) {
      modint val = ex[p.first + i];
      val *= p.second;
      ans += val * coef[i];
    }
  }
  ans -= (modint)(k - 1) * ex[0] * (modint)mod_pow(k, ad);
  ans /= k;
  ans /= mod_pow(k, ad);
  cout << ans << "\n";
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  init_f();
  solve();
  return 0;
}

```