I have an array of 2-d points. Write a function to cluster them into `K` clusters.
[3, 7, 2, 1, 6]
Here is an example function that uses the K-means clustering algorithm to cluster 2D points:

```python
import numpy as np
from sklearn.cluster import KMeans

def cluster_points(points, K):
    # Convert the input points to a 2D numpy array
    points_np = np.array(points)
    
    # Initialize the KMeans object with the desired number of clusters
    kmeans = KMeans(n_clusters=K)
    
    # Fit the KMeans object to the input points
    kmeans.fit(points_np)
    
    # Return the cluster labels assigned to each point, as well as the centroids of the clusters
    return kmeans.labels_, kmeans.cluster_centers_
```

To use this function, you would pass in your array of 2D points as the `points` argument, and specify the desired number of clusters as the `K` argument. The function returns two outputs: the cluster labels assigned to each point (in the same order as the input array), and the centroids of the clusters.
Complete the following task based on the instruction and optional input provided.### Instruction:
I have an array of 2-d points. Write a function to cluster them into `K` clusters.

### Input:
[3, 7, 2, 1, 6]

### Output:
Here is an example function that uses the K-means clustering algorithm to cluster 2D points:

```python
import numpy as np
from sklearn.cluster import KMeans

def cluster_points(points, K):
    # Convert the input points to a 2D numpy array
    points_np = np.array(points)
    
    # Initialize the KMeans object with the desired number of clusters
    kmeans = KMeans(n_clusters=K)
    
    # Fit the KMeans object to the input points
    kmeans.fit(points_np)
    
    # Return the cluster labels assigned to each point, as well as the centroids of the clusters
    return kmeans.labels_, kmeans.cluster_centers_
```

To use this function, you would pass in your array of 2D points as the `points` argument, and specify the desired number of clusters as the `K` argument. The function returns two outputs: the cluster labels assigned to each point (in the same order as the input array), and the centroids of the clusters.