#include <bits/stdc++.h>
using namespace std;
long double PI = acos(-1);
long double DEL = 1e-10;
int mod = 1000000007;
const int N = 1040050;
long long fpow(long long x, long long n) {
  long long res = 1;
  x %= mod;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
void create_fac(long long n) {
  vector<long long> fac(N), inv(N);
  fac[0] = inv[0] = 1;
  for (long long i = 1; i <= n; i++) {
    fac[i] = fac[i - 1] * i % mod;
    inv[i] = fpow(fac[i], mod - 2);
  }
}
long long ncr(long long n, long long r) {
  vector<long long> fac(N), inv(N);
  return fac[n] * (inv[r] * inv[n - r] % mod) % mod;
  return fac[n] * (fpow(fac[r], mod - 2) * fpow(fac[n - r], mod - 2) % mod) %
         mod;
}
void sieve(long long n) {
  vector<long long> primes;
  bool prime[N];
  for (long long i = 2; i < n; ++i) {
    if (prime[i]) primes.push_back(i);
    for (long long j = 0; j < primes.size() && i * primes[j] < n; ++j) {
      prime[i * primes[j]] = false;
      if (i % primes[j] == 0) break;
    }
  }
}
long long cnt, sum, mid, mx, mn, ans, a[N], b[N];
long long n, m, d, i, j, k, l, p, q, r, t, w, x, y, z;
bool f, f1, f2;
string s;
vector<long long> dp(N);
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  vector<vector<long long>> dp(k + 2, vector<long long>(5201, -1e18));
  dp[0][0] = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> x;
    z = x;
    long long five = 0, two = 0;
    while (~x & 1) {
      x >>= 1;
      two++;
    }
    while (z % 5 == 0) {
      z /= 5;
      five++;
    }
    for (long long j = k; j > 0; j--) {
      for (long long l = 26 * i; l >= five; l--) {
        dp[j][l] = max(dp[j][l], dp[j - 1][l - five] + two);
      }
    }
  }
  ans = 0;
  for (long long i = 1; i <= 5200; i++) {
    ans = max(ans, min(dp[k][i], i));
  }
  cout << ans;
}
