#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 20;   unsigned long long bit[N][20], ans, s;   int main() {     int n, k, a;     cin >> n >> k;     for (int x = 1; x < N; x += x & (-x)) bit[x][0]++;     for (int i = 0; i < n; i++) {       cin >> a;       for (int j = k + 1; j > 0; j--) {         s = 0;         for (int x = a; x > 0; x -= x & (-x)) s += bit[x][j - 1];         for (int x = a; x < N; x += x & (-x)) bit[x][j] += s;       }     }     for (int x = n; x > 0; x -= x & (-x)) ans += bit[x][k + 1];     cout << ans;     return 0;   }   