#include <bits/stdc++.h>
using namespace std;
const long long INFll = 1ll * 1000000100 * 1000000100;
const long double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
int main() {
  int n, K;
  cin >> n >> K;
  vector<int> two(n + 1, 0), five(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    while (x % 2 == 0) {
      two[i]++;
      x /= 2;
    }
    while (x % 5 == 0) {
      five[i]++;
      x /= 5;
    }
  }
  int dp[2][K + 1][5300];
  for (int i = 0; i <= 1; i++)
    for (int j = 0; j <= K; j++)
      for (int k = 0; k < 5300; k++) dp[i][j][k] = -1000000100;
  dp[0][0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= K; j++)
      for (int k = 0; k < 5300; k++) {
        dp[1][j][k] = dp[0][j][k];
        if (k >= five[i] && j > 0)
          dp[1][j][k] = max(dp[1][j][k], dp[0][j - 1][k - five[i]] + two[i]);
      }
    for (int j = 0; j <= K; j++)
      for (int k = 0; k < 5300; k++) {
        dp[0][j][k] = dp[1][j][k];
        dp[1][j][k] = -1000000100;
      }
  }
  int ans = 0;
  for (int i = 0; i < 5300; i++) {
    int temp = min(i, dp[0][K][i]);
    if (ans < temp) ans = temp;
  }
  cout << ans;
}
