//Author: Václav Volhejn (-Wave-)
#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define ll long long
const bool distribute = true;
ll fact(int n) {
return n ? (fact(n - 1) * n) : 1;
}
const int MAXK = 26;
map<ll, ll> m[MAXK];
ll s;
int main() {
istream *in = distribute ? (&cin) : (new ifstream("in.txt"));
int n, k;
*in >> n >> k >> s;
ll input[n];
rep(i, 0, n) *in >> input[i];
rep(mask, 0, pow(3, n / 2)) {
int c = mask;
int used = 0;
bool ok = true;
ll sum = 0;
rep(i, 0, n / 2) {
if(c % 3 == 1) sum += input[i];
if(c % 3 == 2) {
used++;
if((used > k) || (input[i] > 18)) {
ok = false;
break;
}
sum += fact(input[i]);
}
c /= 3;
}
if(ok) {
if(!m[used].count(sum))
m[used][sum] = 0;
m[used][sum]++;
}
}
ll res = 0;
rep(mask, 0, pow(3, n - n / 2)) {
int c = mask;
int used = 0;
bool ok = true;
ll sum = 0;
rep(i, n / 2, n) {
if(c % 3 == 1) sum += input[i];
if(c % 3 == 2) {
used++;
if((used > k) || (input[i] > 18)) {
ok = false;
break;
}
sum += fact(input[i]);
}
c /= 3;
}
if(ok) {
rep(i, 0, k - used + 1) {
if(!m[i].count(s - sum)) continue;
res += m[i][s - sum];
}
}
}
cout << res << endl;
return 0;
}
Ly9BdXRob3I6IFbDoWNsYXYgVm9saGVqbiAoLVdhdmUtKQojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxmc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDxtYXA+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgcmVwKGksYSxuKSBmb3IgKGludCBpPWE7aTxuO2krKykKI2RlZmluZSBwZXIoaSxhLG4pIGZvciAoaW50IGk9bi0xO2k+PWE7aS0tKQojZGVmaW5lIGxsIGxvbmcgbG9uZwoKY29uc3QgYm9vbCBkaXN0cmlidXRlID0gdHJ1ZTsKCmxsIGZhY3QoaW50IG4pIHsKICAgIHJldHVybiBuID8gKGZhY3QobiAtIDEpICogbikgOiAxOwp9CmNvbnN0IGludCBNQVhLID0gMjY7Cm1hcDxsbCwgbGw+IG1bTUFYS107CmxsIHM7CgppbnQgbWFpbigpIHsKICAgIGlzdHJlYW0gKmluID0gZGlzdHJpYnV0ZSA/ICgmY2luKSA6IChuZXcgaWZzdHJlYW0oImluLnR4dCIpKTsKICAgIGludCBuLCBrOwogICAgKmluID4+IG4gPj4gayA+PiBzOwogICAgbGwgaW5wdXRbbl07CiAgICByZXAoaSwgMCwgbikgKmluID4+IGlucHV0W2ldOwoKICAgIHJlcChtYXNrLCAwLCBwb3coMywgbiAvIDIpKSB7CiAgICAgICAgaW50IGMgPSBtYXNrOwogICAgICAgIGludCB1c2VkID0gMDsKICAgICAgICBib29sIG9rID0gdHJ1ZTsKICAgICAgICBsbCBzdW0gPSAwOwogICAgICAgIHJlcChpLCAwLCBuIC8gMikgewogICAgICAgICAgICBpZihjICUgMyA9PSAxKSBzdW0gKz0gaW5wdXRbaV07CiAgICAgICAgICAgIGlmKGMgJSAzID09IDIpIHsKICAgICAgICAgICAgICAgIHVzZWQrKzsKICAgICAgICAgICAgICAgIGlmKCh1c2VkID4gaykgfHwgKGlucHV0W2ldID4gMTgpKSB7CiAgICAgICAgICAgICAgICAgICAgb2sgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1bSArPSBmYWN0KGlucHV0W2ldKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjIC89IDM7CiAgICAgICAgfQogICAgICAgIGlmKG9rKSB7CiAgICAgICAgICAgIGlmKCFtW3VzZWRdLmNvdW50KHN1bSkpCiAgICAgICAgICAgICAgICBtW3VzZWRdW3N1bV0gPSAwOwogICAgICAgICAgICBtW3VzZWRdW3N1bV0rKzsKICAgICAgICB9CiAgICB9CiAgICBsbCByZXMgPSAwOwogICAgcmVwKG1hc2ssIDAsIHBvdygzLCBuIC0gbiAvIDIpKSB7CiAgICAgICAgaW50IGMgPSBtYXNrOwogICAgICAgIGludCB1c2VkID0gMDsKICAgICAgICBib29sIG9rID0gdHJ1ZTsKICAgICAgICBsbCBzdW0gPSAwOwogICAgICAgIHJlcChpLCBuIC8gMiwgbikgewogICAgICAgICAgICBpZihjICUgMyA9PSAxKSBzdW0gKz0gaW5wdXRbaV07CiAgICAgICAgICAgIGlmKGMgJSAzID09IDIpIHsKICAgICAgICAgICAgICAgIHVzZWQrKzsKICAgICAgICAgICAgICAgIGlmKCh1c2VkID4gaykgfHwgKGlucHV0W2ldID4gMTgpKSB7CiAgICAgICAgICAgICAgICAgICAgb2sgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1bSArPSBmYWN0KGlucHV0W2ldKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjIC89IDM7CiAgICAgICAgfQogICAgICAgIGlmKG9rKSB7CiAgICAgICAgICAgIHJlcChpLCAwLCBrIC0gdXNlZCArIDEpIHsKICAgICAgICAgICAgICAgIGlmKCFtW2ldLmNvdW50KHMgLSBzdW0pKSBjb250aW51ZTsKICAgICAgICAgICAgICAgIHJlcyArPSBtW2ldW3MgLSBzdW1dOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgY291dCA8PCByZXMgPDwgZW5kbDsKICAgIHJldHVybiAwOwp9