#include <bits/stdc++.h>
using namespace std;
const int N = 9e6 + 10;
const int inf = 0x3f3f3f3f;
long long a[N];
long long f[2][210][6000];
int get(long long x, int d) {
  int res = 0;
  while (x % d == 0) {
    res++;
    x /= d;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  int n, K;
  cin >> n >> K;
  int i, j;
  memset(f, -1, sizeof f);
  for (i = 1; i <= n; i++) cin >> a[i];
  long long sum = 0;
  int cur = 0;
  f[0][0][0] = 0;
  for (i = 1; i <= n; i++) {
    long long d1 = get(a[i], 2);
    long long d2 = get(a[i], 5);
    sum += d1;
    cur ^= 1;
    for (j = 0; j <= i && j <= K; j++) {
      for (long long k = 0; k <= sum; k++) {
        f[cur][j][k] = max(f[cur ^ 1][j][k], f[cur][j][k]);
        if (j >= 1 && k >= d1 && f[cur ^ 1][j - 1][k - d1] >= 0) {
          f[cur][j][k] = max(f[cur][j][k], f[cur ^ 1][j - 1][k - d1] + d2);
        }
      }
    }
  }
  long long ans = 0;
  for (i = 0; i <= sum; i++) {
    ans = max(ans, min(1ll * i, f[cur][K][i]));
  }
  cout << ans << endl;
  return 0;
}
