#include <bits/stdc++.h>
using namespace std;
int main() {
  map<long long int, long long int> m;
  long long int n, k;
  cin >> n >> k;
  long long int a[n];
  long long int x = 0;
  for (long long int i = 0; i < n; ++i) {
    cin >> a[i];
    x += a[i] / 10;
    m[a[i] % 10]++;
    if (a[i] % 10)
      a[i] = ((a[i] / 10) + 1) * 10;
    else
      a[i] = ((a[i] / 10)) * 10;
  }
  for (long long int i = 9; i >= 1; --i) {
    if ((10 - i) * m[i] <= k) {
      k -= (10 - i) * m[i];
      x += m[i];
      continue;
    } else {
      x += k / (10 - i);
      cout << x;
      return 0;
    }
  }
  for (long long int i = 0; i < n; ++i) {
    if (a[i] == 100) continue;
    if (100 - a[i] <= k) {
      x += (100 - a[i]) / 10;
      k -= 100 - a[i];
    } else {
      x += k / 10;
      break;
    }
  }
  cout << x << endl;
  return 0;
}
