#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a[100000];
  cin >> n >> k;
  int skill = 0;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 9; i > 0; i--) {
    for (int j = 0; j < n; j++) {
      int tp = a[j] % 10;
      if (a[j] != 100 && tp == i) {
        if (k >= 10 - tp) {
          a[j] += (10 - tp);
          k -= (10 - tp);
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i] != 100 && a[i] % 10 == 0) {
      int diff = 100 - a[i];
      if (k >= diff) {
        a[i] += diff;
        k -= diff;
      } else {
        int maxSum = k / 10;
        a[i] += maxSum * 10;
        k = k - maxSum * 10;
      }
    }
  }
  skill = 0;
  for (int i = 0; i < n; ++i) {
    skill += (a[i] / 10);
  }
  cout << skill << endl;
}
