#include <bits/stdc++.h>
using namespace std;
struct Nod {
  long long a;
  int x, y;
  Nod() { a = x = y = 0; }
} nod[220];
void fun(Nod *p) {
  long long x = p->a;
  while (x % 2 == 0) {
    p->x++;
    x /= 2;
  }
  x = p->a;
  while (x % 5 == 0) {
    p->y++;
    x /= 5;
  }
}
int dp[210][18 * 210];
bool vis[220];
int main() {
  int n, k, MAXY = 0;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> nod[i].a, fun(&nod[i]), MAXY += nod[i].y;
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = k; j >= 1; j--) {
      for (int k = MAXY; k >= 0; k--) {
        if (k - nod[i].y < 0) continue;
        if (dp[j - 1][k - nod[i].y] == -1) continue;
        dp[j][k] = max(dp[j][k], dp[j - 1][k - nod[i].y] + nod[i].x);
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= MAXY; i++) {
    ans = max(ans, min(i, dp[k][i]));
  }
  printf("%d\n", ans);
  return 0;
}
