func_code_string: #include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   template <class T>   void out(const vector<T> &a) {     cout <<  array:  ;     for (int i = 0; i < (int)a.size(); i++) cout << a[i] <<    ;     cout << endl;     cout.flush();   }   template <class T>   T gcd(T a, T b) {     return (b == 0) ? a : gcd(b, a % b);   }   template <class T>   T Abs(T x) {     return x > 0 ? x : -x;   }   template <class T>   inline bool isPrime(T n) {     if (n <= 1) return false;     for (T i = 2; i * i <= n; i++)       if (n % i == 0) return false;     return true;   }   template <class T>   T lcm(T a, T b) {     return a * (b / gcd(a, b));   }   template <typename T>   static T mod(T a, T b) {     a %= b;     if (a < 0) a += b;     return a;   }   template <class T>   string toString(T n) {     ostringstream oss;     oss << n;     oss.flush();     return oss.str();   }   template <typename T>   static void splitstr(const string &s, vector<T> &out) {     istringstream in(s);     out.clear();     copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out));   }   int toInt(string s) {     int r = 0;     istringstream sin(s);     sin >> r;     return r;   }   long long toLl(string s) {     long long r = 0;     istringstream sin(s);     sin >> r;     return r;   }   bool IsVowel(char ch) {     ch = tolower(ch);     if (ch ==  a  || ch ==  e  || ch ==  i  || ch ==  o  || ch ==  u )       return true;     return false;   }   int BigMod(long long B, long long P, long long M) {     long long R = 1;     while (P > 0) {       if (P % 2 == 1) {         R = (R * B) % M;       }       P /= 2;       B = (B * B) % M;     }     return (int)R;   }   long long mulmod(long long a, long long b, long long c) {     long long x = 0, y = a % c;     while (b > 0) {       if (b % 2 == 1) {         x = (x + y) % c;       }       y = (y * 2) % c;       b /= 2;     }     return x % c;   }   void binprint(int mask, int n) {     int i;     string s =   ;     do {       s += (mask % 2 +  0 );       mask /= 2;     } while (mask);     reverse(s.begin(), s.end());     s = string((n - (int)s.size() > 0 ? n - (int)s.size() : 0),  0 ) + s;     for (i = (int)s.size() - n; i < (int)s.size(); i++) printf( %c , s[i]);     printf(  n );   }   long long mpow(long long x, long long k) {     if (k == 0) return 1;     long long r = mpow(x, k / 2);     return k % 2 ? (r * r * x) : (r * r);   }   int main() {     long long n, k, x[500], cnt, i;     cin >> n >> k;     for (i = 0; i < n; i++) cin >> x[i];     cnt = 0;     while (x[0] != k) {       for (i = 0; i < n - 1; i++) {         if (x[i] != x[i + 1]) x[i]++;       }       x[n - 1]++;       cnt++;     }     cout << cnt << endl;     return 0;   }   