#include <bits/stdc++.h>
using namespace std;
int p2[203];
int p5[203];
int dpcur[203][5003][2];
int dpnxt[203][5003][2];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    long long int x;
    cin >> x;
    while (x % 2 == 0) {
      x /= 2;
      p2[i]++;
    }
    while (x % 5 == 0) {
      x /= 5;
      p5[i]++;
    }
  }
  memset(dpcur, -1, sizeof(dpcur));
  memset(dpnxt, -1, sizeof(dpnxt));
  dpcur[k][0][0] = 0;
  if (p2[1] >= p5[1]) {
    dpcur[k - 1][p2[1] - p5[1]][0] = p5[1];
  } else {
    dpcur[k - 1][p5[1] - p2[1]][1] = p2[1];
  }
  for (int i = 2; i <= n; i++) {
    for (int K = k; K >= max(0, k - (i - 1)); K--) {
      for (int excess_cnt = 0; excess_cnt <= min(5000, 60 * (i - 1));
           excess_cnt++) {
        if (dpcur[K][excess_cnt][0] != -1) {
          dpnxt[K][excess_cnt][0] =
              max(dpnxt[K][excess_cnt][0], dpcur[K][excess_cnt][0]);
          int cnt2 = p2[i] + excess_cnt;
          int cnt5 = p5[i];
          if (cnt2 >= cnt5 && K - 1 >= 0) {
            dpnxt[K - 1][min(cnt2 - cnt5, 5000)][0] =
                max(dpnxt[K - 1][min(cnt2 - cnt5, 5000)][0],
                    dpcur[K][excess_cnt][0] + cnt5);
          } else if (cnt5 > cnt2 && K - 1 >= 0) {
            dpnxt[K - 1][min(cnt5 - cnt2, 5000)][1] =
                max(dpnxt[K - 1][min(cnt5 - cnt2, 5000)][1],
                    dpcur[K][excess_cnt][0] + cnt2);
          }
        }
        if (dpcur[K][excess_cnt][1] != -1) {
          dpnxt[K][excess_cnt][1] =
              max(dpnxt[K][excess_cnt][1], dpcur[K][excess_cnt][1]);
          int cnt2 = p2[i];
          int cnt5 = p5[i] + excess_cnt;
          if (cnt2 >= cnt5 && K - 1 >= 0) {
            dpnxt[K - 1][min(cnt2 - cnt5, 5000)][0] =
                max(dpnxt[K - 1][min(cnt2 - cnt5, 5000)][0],
                    dpcur[K][excess_cnt][1] + cnt5);
          } else if (cnt5 > cnt2 && K - 1 >= 0) {
            dpnxt[K - 1][min(cnt5 - cnt2, 5000)][1] =
                max(dpnxt[K - 1][min(cnt5 - cnt2, 5000)][1],
                    dpcur[K][excess_cnt][1] + cnt2);
          }
        }
      }
    }
    for (int K = k; K >= max(0, k - i); K--) {
      for (int excess_cnt = 0; excess_cnt <= min(5000, 60 * i); excess_cnt++) {
        for (int excess = 0; excess <= 1; excess++) {
          dpcur[K][excess_cnt][excess] = dpnxt[K][excess_cnt][excess];
        }
      }
    }
    memset(dpnxt, -1, sizeof(dpnxt));
  }
  int ans = 0;
  for (int excess_cnt = 0; excess_cnt <= 5000; excess_cnt++) {
    for (int excess = 0; excess <= 1; excess++) {
      ans = max(ans, dpcur[0][excess_cnt][excess]);
    }
  }
  cout << ans << "\n";
}
