#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const long long MAXN = 100005;
long long n, m, o, a[MAXN], b[MAXN], f[2][205][5005];
int main() {
  n = read();
  m = read();
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  for (long long i = (1); i <= (n); ++i) {
    long long x = read();
    while (x % 2 == 0) a[i]++, x /= 2;
    while (x % 5 == 0) b[i]++, x /= 5;
  }
  memset(f, 0, sizeof(f));
  f[0][0][0] = 1;
  o = 0;
  for (long long i = (1); i <= (n); ++i) {
    o = 1 - o;
    memset(f[o], 0, sizeof(f[o]));
    for (long long j = (0); j <= (i); ++j)
      for (long long k = (0); k <= (j * 25); ++k) {
        f[o][j][k] = max(f[o][j][k], f[1 - o][j][k]);
        if (k >= b[i] && j > 0 && f[1 - o][j - 1][k - b[i]] > 0)
          f[o][j][k] = max(f[o][j][k], f[1 - o][j - 1][k - b[i]] + a[i]);
      }
  }
  long long ans = 0;
  for (long long i = (0); i <= (m * 25); ++i)
    ans = max(ans, min(f[o][m][i] - 1, i));
  cout << ans << endl;
  return 0;
}
