#include <bits/stdc++.h>
using namespace std;
int compare(int a, int b) { return (10 - a % 10) % 10 < (10 - b % 10) % 10; }
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end(), compare);
  int rating = 0;
  for (int i = 0; i < n; i++) {
    int x = min((10 - a[i] % 10) % 10, k);
    a[i] += x;
    k -= x;
  }
  for (int i = 0; i < n; i++) {
    int x = min(100 - a[i], k);
    a[i] += x;
    k -= x;
    rating += a[i] / 10;
  }
  cout << rating << endl;
  return 0;
}
