#include <bits/stdc++.h>
using namespace std;
const int maxn = 5205;
const int INF = 100000;
long long int a[maxn], two[maxn], five[maxn];
long long int dp[210][maxn];
int main() {
  long long int n, k, cnt2 = 0, cnt5 = 0, i, j;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cnt2 = 0, cnt5 = 0;
    cin >> a[i];
    long long int x = a[i];
    while (x % 5 == 0) {
      x /= 5;
      cnt5++;
    }
    while (x % 2 == 0) {
      x /= 2;
      cnt2++;
    }
    two[i] = cnt2;
    five[i] = cnt5;
  }
  for (i = 0; i <= k; i++)
    for (j = 1; j < 5200; j++) dp[i][j] = -INF;
  for (i = 0; i < n; i++) {
    for (j = min(k - 1, i); j >= 0; j--) {
      for (int l = 0; l + five[i] < 5200; l++)
        dp[j + 1][l + five[i]] = max(dp[j + 1][l + five[i]], dp[j][l] + two[i]);
    }
  }
  long long int ans = 0;
  for (i = 0; i < 5200; i++) ans = max(ans, min(dp[k][i], i));
  cout << ans << endl;
  return 0;
}
