#include <bits/stdc++.h>
using namespace std;
int n, k, dp[2][202][26 * 202];
struct dat {
  long long int v;
  int two, five;
  dat() { two = five = 0; }
} num[205];
int main() {
  scanf("%d%d", &n, &k);
  int i, j, l;
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &num[i].v);
    long long int t = num[i].v;
    while (t % 2 == 0) ++num[i].two, t /= 2;
    t = num[i].v;
    while (t % 5 == 0) ++num[i].five, t /= 5;
  }
  for (i = 0; i <= 1; i++)
    for (j = k; j >= 0; j--)
      for (l = 0; l <= 26 * 200; l++) dp[i][j][l] = -1000000;
  dp[0][0][0] = 0;
  for (i = 1; i <= n; i++)
    for (j = min(k, i); j >= 0; j--)
      for (l = 0; l <= 26 * 200; l++) {
        dp[i & 1][j][l] = max(dp[i & 1][j][l], dp[~i & 1][j][l]);
        if (l >= num[i].five && j > 0)
          dp[i & 1][j][l] = max(
              dp[i & 1][j][l], dp[~i & 1][j - 1][l - num[i].five] + num[i].two);
      }
  int ans = 0;
  for (i = 0; i <= 26 * 200; i++) {
    ans = max(ans, min(i, dp[n & 1][k][i]));
  }
  printf("%d", ans);
  return 0;
}
