#include <bits/stdc++.h>
using namespace std;
bool compare(int i, int j) { return ((i % 10) > (j % 10)); }
int main() {
  int n, k, sum = 0;
  cin >> n >> k;
  int v[n];
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v, v + n, compare);
  for (int i = 0; i < n; i++) {
    k = k - (10 - (v[i] % 10));
    v[i] = v[i] + (10 - (v[i] % 10));
    if (k < 0) break;
  }
  for (int i = 0; i < n; i++) {
    k = k - (100 - v[i]);
    if (k < 0) {
      v[i] = v[i] + k + (100 - v[i]);
      break;
    }
    v[i] = v[i] + (100 - v[i]);
  }
  for (int i = 0; i < n; i++) {
    sum = sum + v[i] / 10;
  }
  cout << sum << endl;
  return 0;
}
