#include <bits/stdc++.h>
using namespace std;
int a[100010], b[11];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int ans = 0;
  for (int z = 0; z < 11; z++) b[z] = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    ans += a[i] / 10;
    if (a[i] != 100) {
      b[a[i] % 10]++;
    }
  }
  for (int i = 9; i >= 0 && k > 0; i--) {
    if (k >= (10 - i) * b[i]) {
      k -= (10 - i) * b[i];
      ans += b[i];
    } else {
      ans += k / (10 - i);
      k = 0;
    }
  }
  ans += k / 10;
  printf("%d\n", min(ans, n * 10));
  return 0;
}
