#include <bits/stdc++.h>
using namespace std;
int n, k;
pair<int, int> arr[100005];
int main() {
  scanf("%d %d", &n, &k);
  int a, sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a;
    arr[i].first = a % 10;
    arr[i].second = a;
    sum += a / 10;
  }
  sort(arr, arr + n);
  reverse(arr, arr + n);
  bool f = 1, s = 1;
  while (f && s) {
    s = 0;
    for (int i = 0; i < n; i++) {
      if (k >= 10 - arr[i].first && arr[i].second != 100) {
        sum++;
        k -= 10 - arr[i].first;
        arr[i].second += 10 - arr[i].first;
        arr[i].first = 0;
      } else if (arr[i].second != 100) {
        f = 0;
        break;
      }
      if (arr[i].second != 100) s = 1;
    }
  }
  cout << sum << endl;
  return 0;
}
