#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[11];
  for (int i = 0; i < 11; i++) {
    a[i] = 0;
  }
  int points = 0;
  int potential = 0;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    points += tmp / 10;
    potential += (100 - tmp) / 10;
    a[(100 - tmp) % 10]++;
  }
  a[10] = potential;
  for (int i = 1; i < 11; i++) {
    int canImp = k / i;
    int imp = min(canImp, a[i]);
    a[i] -= imp;
    points += imp;
    k -= i * imp;
  }
  cout << points << endl;
  return 0;
}
