#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> i, pair<int, int> j) { return i.first > j.first; }
int main() {
  int a, n, sm = 0;
  int x[100001];
  pair<int, int> y[100001];
  long long int k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    sm += x[i] / 10;
    y[i].first = x[i] % 10;
    y[i].second = i;
  }
  sort(y, y + n, cmp);
  int c;
  bool checker = true;
  while (k > 0 && checker) {
    checker = false;
    for (int j = 0; j < n; j++) {
      c = 10 - y[j].first;
      if (c >= 0) {
        if (k >= c) {
          if (x[y[j].second] + c <= 100) {
            checker = true;
            k -= c;
            x[y[j].second] += c;
            y[j].first = 0;
            sm++;
          }
        }
      }
    }
  }
  cout << sm << endl;
  return 0;
}
