#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, mas[1000010] = {-1}, base = 0, count[10] = {0};
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> mas[i];
    base = base + mas[i] / 10;
    if (mas[i] == 100) continue;
    count[mas[i] % 10]++;
    count[0] += 10 - mas[i] / 10 - 1;
  }
  for (int i = 9; i >= 0; i--) {
    if ((10 - i) * count[i] <= k) {
      base = base + count[i];
      k = k - (10 - i) * count[i];
    } else {
      base = base + k / (10 - i);
      break;
    }
  }
  cout << base;
  return 0;
}
