#include <bits/stdc++.h>
using namespace std;
struct node {
  long long t, f;
  node() { t = f = 0; }
  node(long long T, long long F) { t = T, f = F; }
} p[205];
long long n, k, a[205], dp[2][205][5005];
node get(long long x) {
  long long t = 0, f = 0;
  long long tmp = x;
  while (x % 2 == 0) ++t, x /= 2;
  x = tmp;
  while (x % 5 == 0) ++f, x /= 5;
  return {t, f};
}
int main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  memset(dp, -1, sizeof dp);
  dp[0][0][0] = 0;
  long long up = 0;
  for (long long i = 1; i <= n; ++i) {
    long long now = i & 1;
    p[i] = get(a[i]);
    up += p[i].f;
    for (long long j = 0; j <= min(i, k); ++j) {
      for (long long l = 0; l <= up; ++l) {
        dp[now][j][l] = dp[now ^ 1][j][l];
        if (j && l >= p[i].f && ~dp[now ^ 1][j - 1][l - p[i].f])
          dp[now][j][l] =
              max(dp[now][j][l], dp[now ^ 1][j - 1][l - p[i].f] + p[i].t);
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i <= up; ++i) ans = max(ans, min(i, dp[n & 1][k][i]));
  cout << ans;
  return 0;
}
