#include <bits/stdc++.h>
using namespace std;
char buff[100000];
int pos;
long long get_nr() {
  while (!(buff[pos] >= '0' && buff[pos] <= '9')) pos++;
  long long nr = 0;
  while (buff[pos] >= '0' && buff[pos] <= '9') {
    nr = nr * 10 + buff[pos] - '0';
    pos++;
  }
  return nr;
}
int n, i, maxi, nr, m, j, k, t;
long long v[210];
int dp[2][210][27 * 210];
int main() {
  FILE *fin = stdin;
  FILE *fout = stdout;
  fread(buff, 1, 100000, fin);
  n = get_nr(), k = get_nr();
  long long maxim = 0;
  for (i = 1; i <= n; i++) {
    v[i] = get_nr();
    maxim = max(maxim, v[i]);
  }
  long long p = 1;
  int maxi = 0;
  while (p <= maxim) {
    p *= 5;
    maxi++;
  }
  maxi *= n;
  for (i = 0; i <= k; i++)
    for (j = 0; j <= maxi; j++) dp[1][i][j] = -1;
  long long nr = v[1];
  int exp5 = 0, exp2 = 0;
  while (nr % 5 == 0) {
    exp5++;
    nr /= 5;
  }
  while (nr % 2 == 0) {
    exp2++;
    nr /= 2;
  }
  dp[1][1][exp5] = exp2;
  dp[1][0][0] = 0;
  int sol = min(dp[1][1][exp5], exp5);
  t = 0;
  for (i = 2; i <= n; i++) {
    long long nr = v[i];
    int cnt2 = 0, cnt5 = 0;
    while (nr % 2 == 0) {
      cnt2++;
      nr /= 2;
    }
    while (nr % 5 == 0) {
      cnt5++;
      nr /= 5;
    }
    for (j = 0; j <= k; j++)
      for (int exp5 = 0; exp5 <= maxi; exp5++) dp[t][j][exp5] = -1;
    dp[t][0][0] = 0;
    for (j = 1; j <= min(i, k); j++) {
      for (int exp5 = 0; exp5 <= maxi; exp5++) {
        if (dp[1 - t][j][exp5] != -1) dp[t][j][exp5] = dp[1 - t][j][exp5];
        if (exp5 - cnt5 >= 0 && dp[1 - t][j - 1][exp5 - cnt5] != -1)
          dp[t][j][exp5] =
              max(dp[t][j][exp5], dp[1 - t][j - 1][exp5 - cnt5] + cnt2);
      }
    }
    for (int exp5 = 0; exp5 <= maxi; exp5++)
      sol = max(sol, min(dp[t][k][exp5], exp5));
    t = 1 - t;
  }
  fprintf(fout, "%d", sol);
  return 0;
}
