#include <bits/stdc++.h>
using namespace std;
struct data {
  int a, b;
  bool operator<(const data& rhs) const { return b < rhs.b; }
} d[654321];
int n, k, ans, ans1;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &d[i].a);
    ans += d[i].a / 10;
    if (d[i].a % 10 == 0) continue;
    d[i].b = 10 - (d[i].a % 10);
  }
  sort(d + 1, d + n + 1);
  for (int i = 1; i <= n; i++) {
    if (d[i].b == 0) {
      ans1 += (100 - d[i].a) / 10;
      continue;
    }
    if (k >= d[i].b) {
      k -= d[i].b;
      d[i].a += d[i].b;
      ans++;
      ans1 += (100 - d[i].a) / 10;
    } else
      break;
  }
  ans += min(k / 10, ans1);
  printf("%d\n", ans);
  return 0;
}
