#include <bits/stdc++.h>
using namespace std;
int a[100010];
int b[15];
bool cmp(int x, int y) {
  if (x == 100 || y == 100)
    return x < y;
  else
    return x % 10 > y % 10;
}
int main() {
  int n, k;
  b[0] = 0;
  for (int i = 1; i <= 10; i++) b[i] = b[i - 1] + 10;
  while (scanf("%d%d", &n, &k) != EOF) {
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + n + 1, cmp);
    for (int i = 1; i <= n; i++) {
      if (k <= 0) break;
      if (a[i] % 10 == 0 || a[i] == 100) continue;
      int pos = upper_bound(b + 1, b + 11, a[i]) - b;
      int num = b[pos] - a[i];
      if (num > k) break;
      a[i] = b[pos];
      k -= num;
    }
    int ans = 0, sum = 0;
    for (int i = 1; i <= n; i++) {
      ans += a[i] / 10;
      sum += 100 - a[i];
    }
    printf("%d\n", ans + min(sum, k) / 10);
  }
  return 0;
}
