#include <bits/stdc++.h>
using namespace std;
const int N = 202;
const int C = 6000;
int dp[N][C];
int n, k;
int a[N][2];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    long long x;
    scanf("%lld", &x);
    while (x % 5 == 0) {
      a[i][0]++;
      x /= 5;
    }
    while (x % 2 == 0) {
      a[i][1]++;
      x /= 2;
    }
  }
  for (int i = 0; i <= k; i++)
    for (int j = 0; j < C; j++) dp[i][j] = -1;
  dp[0][0] = 0;
  for (int i = 0; i < n; i++)
    for (int j = k - 1; j >= 0; j--)
      for (int x = 0; x < C; x++) {
        if (dp[j][x] == -1) continue;
        dp[j + 1][x + a[i][0]] =
            max(dp[j + 1][x + a[i][0]], dp[j][x] + a[i][1]);
      }
  int ans = 0;
  for (int i = 0; i < C; i++) ans = max(ans, min(dp[k][i], i));
  printf("%d\n", ans);
  return 0;
}
