/*
* Author: Geeza
*/

#include <bits/stdc++.h>

#define ld long double
#define ll long long
#define pb push_back
#define fin(a, n) for(int i = a; i < n; i++)
#define fjn(a, n) for(int j = a; j < n; j++)
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define FAST ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)

using namespace std;

const double PI = acos(-1);
const int N = 1e5+5;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000000007, inf = 1e6;

string di[] = {"D","L", "U", "R", "UL", "UR", "DL", "DR"};
int dx[] = {+1, +0, +0, -1, -1, -1, +1, +1};
int dy[] = {+0, -1, +1, +0, -1, +1, -1, +1};
char dc[] = {'D', 'L', 'R', 'U'};

ll n, k;
vector<ll> v;
map<ll, pair<ll, ll>> mp;
ll dp[205][205][100];

ll calc(int idx, int rem, ll fives) {
    if (rem == 0) return fives == 0? 0 : -oo;
    if (idx == v.size()) return -oo;

    ll &ret = dp[idx][rem][fives];
    if (~ret) return ret;

    ret = calc(idx+1, rem, fives);
    return ret = max(calc(idx+1, rem-1, max(fives-mp[v[idx]].second, 0ll)) + mp[v[idx]].first, ret);
}

void solve() {
    cin >> n >> k;
    v.assign(n, 0);
    fin(0, n) cin >> v[i];

    fin(0, n) {
        ll tmp = v[i];
        bool good = true;
        while (good && tmp > 0) {
            if (tmp%2 == 0) {
                mp[v[i]].first++;
                tmp /= 2;
                continue;
            }
            if (tmp%5 == 0) {
                mp[v[i]].second++;
                tmp  /= 5;
                continue;
            }
            good = false;
        }
    }

    memset(dp, -1, sizeof dp);
    ll ans = -oo;
    for (int i = 10; i >= 0; i--) {
        ans = max(min((ll)i, calc(0, k, i)), ans);
    }
    cout << ans << "\n";
}

int main() {
    FAST;
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    int tt = 1; //cin >> tt;
    while(tt--){
        solve();
    }
    return 0;
}