#include <iostream>
#include <vector>
#include <string>
#include <set>
#define MAX 10
using namespace std;
vector<int> v;
set<string> s;
bool check[MAX + 1];
void solve(int depth, int limit, string str) {
int i;
if (depth == limit) {
s.insert(str);
return;
}
for (i = 0; i < v.size(); i++) {
if (!check[i]) {
check[i] = true;
solve(depth + 1, limit, str + to_string(v[i]));
check[i] = false;
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, k, i, tmp;
cin >> n >> k;
for (i = 0; i < n; i++) {
cin >> tmp;
v.push_back(tmp);
}
solve(0, k, "");
cout << s.size() << endl;
return 0;
}