#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, co;
  int a[100019];
  cin >> n >> co;
  int count = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    count += a[i] / 10;
    a[i] %= 10;
  }
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = 0; i < n; i++) {
    if (co >= 10 - a[i]) {
      count++;
      co -= (10 - a[i]);
    }
  }
  cout << min(10 * n, count + co / 10) << endl;
  return 0;
}
